package com.cssl.util;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.CircleCaptcha;

public class ImageCode {


    public static String getNumber() {
        return number;
    }

    public static void setNumber(String number) {
        ImageCode.number = number;
    }

    static String  number;



    public static String createImageCode(){
//  150、50为图形的长、宽。 4表示生成4位验证码，3表示干扰线是3位
        CircleCaptcha circleCaptcha = CaptchaUtil.createCircleCaptcha(150, 50, 4, 3);
        String codeValue = circleCaptcha.getCode();
        setNumber(codeValue);
        String imageBase64 = circleCaptcha.getImageBase64();
//    "data:images/png;base64,"+imageBase64    直接显示
        return "data:images/png;base64,"+imageBase64;
    }


}
